import service from '@/core/net/request'
import { queryParams } from '@/core/utils/tools'

export function getOrderList(page, query = {}) {
  let r = queryParams(query)
  return service.get(`/api/admin/order/${page}${r}`)
}

export function deleteOrder(ids) {
  return service.post(`/api/admin/order/delete_all`, {
    ids,
  })
}

export function exportOrder(query = {}) {
  let r = queryParams(query)
  return service.post(
    `/api/admin/order/excelexport${r}`,
    {},
    {
      responseType: 'blob',
    }
  )
}

export function getShipInfo(id) {
  return service.get(`/api/admin/order/${id}/get_ship_info`)
}

export function refundOrder(id, data) {
  return service.post(`/api/admin/order/${id}/handle_refund`, data)
}
